/*
* File: Eurler's phi function
* Author: Dongcheng Li
* Date: 20190924
* Purpose: Write a program to compute Eurler's phi function. That is, given an integer $n$, return $\phi(n)$.
* https://w.ketangpai.com/pages/homework/homework-detail.html
*/
#include<iostream>
using namespace std;
/*
* Input: an integer n
* Output: return the result of Eurler's phi function.
* Purpose: Number of numbers that are n-negative with n in a positive integer less than or equal to n
* Method: By using the GCD.
*/

int GCD(int integer_a, int integer_b)//return the result of GCD.
{
	int container;
	while (integer_b != 0)
	{
		container = integer_a;
		integer_a = integer_b;
		integer_b = container % integer_b;
	}
	return integer_a;
}

int Eurler(int integer_n) {//return the result of Eurler.
	int counter;
	int counter_2=0;
	for (counter = 1; counter < integer_n; counter++)
	{
		if (GCD(integer_n, counter) == 1)
		{
			
			counter_2++;
		}
	}
	return counter_2;
}
int main() {
	int integer_A;
	/*
integer_A=n
*/
	cout << "n:" << endl;
	cin >> integer_A;//put in n.
	cout << "Eurler(" << integer_A <<")=";
	cout << Eurler(integer_A) << endl;
}
